<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background: red;
            float: right;
        }

        .box2 {
            width: 200px;
            height: 100px;
            background: green;
            float: left;

        }

        .box3 {
            width: 100px;
            height: 100px;
            background: blue;

        }

        .box4 {
            width: 100px;
            height: 100px;
            background: pink;
            /* 
            clear清除上方浮动元素的影响
            如果上方是左浮动 clear:left;
            如果上方是右浮动 clear:right;
            如果是左边+右边浮动影响 clear:both;
            */
            clear: both;

        }
    </style>
</head>

<body>
    <div class="box1">1</div>
    <div class="box2">2</div>
    <div class="box3">3</div>
    <div class="box4"></div>
</body>

</html>